/*
 * Copyright (C) 2003-2008 Wang Pengcheng <wpc0000@gmail.com>
 * Permission is granted to copy, distribute and/or modify this
 * document under the terms of the GNU Free Documentation License,
 * Version 2.0 or any later version published by the Free Software Foundation;
 * with no Invariant Sections.
 * You may obtain a copy of the License at
 *   http://www.gnu.org/licenses/lgpl.txt
 */
//May 5, 2008

package cn.edu.whu.control;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class BasicDataForEdit {
	//Be carefol to change the dir,it must need the '/'
	//And the child dir should contains all the datas.
	public static final String TEMPLATE_FILE_DIR = "templates/";//"cn/edu/whu/templateFile/";
	private static InputStream INPUT;
	private static final String DB_BEAN_MAP_CONFIG_FILE = "beanDbMap.txt";
	private static final String[] TYPE_CLASS={"int","String","Date"};
	private static final String[] TYPE_DATABASE={"INTEGER","VARCHAR(255)","DATE"};
	private static Map<String, String> map = new HashMap<String, String>();
	public static final String DIR_SPLIT = File.separator ;
	static{
		
		try {
			INPUT = new FileInputStream(DB_BEAN_MAP_CONFIG_FILE);
			Scanner in = new Scanner(INPUT);
//			for(int i=0;i<TYPE_CLASS.length;i++){
//				//map.put(TYPE_CLASS[i], TYPE_DATABASE[i]);
//				
//			}
			while(in.hasNext()){
				//Type_class    Type_DATABASE
				map.put(in.next(),in.next());
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static String getDatabaseType(String classType){
		return map.get(classType);
	}

}

